using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace Irc.Net
{
	/// <summary>
	/// Description of ServerTab.
	/// </summary>
	public partial class ServerTab : UserControl
	{
		public ServerTab(string target)
		{
			InitializeComponent();
			CommandText.Name = Name + "-"+ CommandText.Name;
			CommandText.KeyDown += Main.ParseCommand;
			Dock = DockStyle.Fill;
			Text = Name = target;
		}
		public void AddMessage(Irc.Objects.Message message)
		{
			if(ServerText.Created)
				ServerText.BeginInvoke((MethodInvoker)delegate {
					ServerText.AppendMessage(message);
				});
			Refocus();
		}
		public void Refocus()
		{
			if(CommandText.Created)
				CommandText.BeginInvoke((MethodInvoker)delegate { CommandText.Focus(); });
		}
	}
}
